export function setSearchOption(self) {
  return {
    menuSpan: 6,
    submitBtn: false,
    emptyBtn: false,
    column: [
      {
        label: '名称',
        prop: 'name',
        span: 6
      },
      {
        label: '编码',
        prop: 'code',
        span: 6
      },
      {
        label: '物料类别',
        prop: 'partCategoryIds',
        span: 6,
        type: 'tree',
        dicUrl: '/api/mes-admin/part-category/tree',
        props: {
          label: 'title',
          value: 'id'
        }
      },
      {
        label: '物料',
        prop: 'categoryNames',
        type: 'search',
        span: 6,
        appendClick: () => {
          self.openMaterialModel();
        }
      }
    ]
  };
}

export const tableOption = {
  lazy: true,
  size: 'small',
  height: 'calc(100vh - 585px)',
  calcHeight: 30,
  tip: false,
  searchShow: true,
  searchMenuSpan: 6,
  border: true,
  index: false,
  addBtn: false,
  delBtn: false,
  viewBtn: false,
  editBtn: false,
  refreshBtn: false,
  selection: false,
  dialogClickModal: false,
  labelWidth: 120,
  menuWidth: 230,
  searchLabelWidth: 90,
  columnBtn: false,
  column: [
    {
      label: '名称',
      prop: 'name'
    },
    {
      label: '编码',
      prop: 'code',
      maxlength: 32
    },
    {
      label: '等级',
      prop: 'level',
      formatter: (val) => {
        return `L${val.level}`;
      }
    },
    {
      label: '物料类别',
      prop: 'partCategoryNames'
    },
    {
      label: '物料',
      prop: 'partMasterNames'
    }
  ]
};

export const detailOption = {
  submitBtn: false,
  emptyBtn: false,
  column: [
    {
      label: '名称',
      prop: 'name',
      span: 8,
      disabled: true
    },
    {
      label: '编码',
      prop: 'code',
      span: 8,
      disabled: true
    },
    {
      label: '等级',
      prop: 'level',
      type: 'select',
      span: 8,
      disabled: true,
      dicData: [
        { label: 'L1', value: 1 },
        { label: 'L2', value: 2 },
        { label: 'L3', value: 3 },
        { label: 'L4', value: 4 },
        { label: 'L5', value: 5 },
        { label: 'L6', value: 6 },
        { label: 'L7', value: 7 },
        { label: 'L8', value: 8 },
        { label: 'L9', value: 9 },
        { label: 'L10', value: 10 }
      ]
    },
    {
      label: '物料类别',
      prop: 'partCategoryNames',
      span: 24,
      disabled: true
    },
    {
      label: '物料',
      prop: 'material',
      type: 'number',
      span: 24,
      disabled: true,
      formslot: true
    }
  ]
};

export const detailTableOption = {
  size: 'small',
  height: '300',
  calcHeight: 30,
  tip: false,
  searchShow: false,
  border: true,
  index: false,
  addBtn: false,
  delBtn: false,
  viewBtn: false,
  editBtn: false,
  refreshBtn: false,
  selection: false,
  dialogClickModal: false,
  labelWidth: 120,
  searchLabelWidth: 90,
  columnBtn: false,
  menu: false,
  column: [
    {
      label: '物料类别',
      prop: 'categoryName'
    },
    {
      label: '物料',
      prop: 'name'
    }
  ]
};

export function getMaterialTableOption(self) {
  return {
    lazy: true,
    size: 'small',
    height: '300',
    calcHeight: 30,
    reserveSelection: true, //翻页勾选
    tip: false,
    searchShow: true,
    border: true,
    index: false,
    addBtn: false,
    delBtn: false,
    viewBtn: false,
    editBtn: false,
    refreshBtn: false,
    selection: true,
    dialogClickModal: false,
    labelWidth: 120,
    searchLabelWidth: 90,
    columnBtn: false,
    menu: false,
    // selectable: (row, index) => {
    //   const ids = self.templateData.map((i) => i.id);
    //   return !ids.includes(row.id);
    // },
    column: [
      {
        label: '物料类别',
        prop: 'categoryName'
      },
      {
        label: '物料',
        prop: 'name'
      }
    ]
  };
}

export function getTemplateMaterialTableOption(self) {
  return {
    size: 'small',
    height: '300',
    calcHeight: 30,
    tip: false,
    searchShow: true,
    border: true,
    index: false,
    addBtn: false,
    delBtn: false,
    viewBtn: false,
    editBtn: false,
    refreshBtn: false,
    selection: true,
    dialogClickModal: false,
    labelWidth: 120,
    searchLabelWidth: 90,
    columnBtn: false,
    menu: false,
    // selectable: (row, index) => {
    //   const ids = self.templateData.map((i) => i.id);
    //   return !ids.includes(row.id);
    // },
    column: [
      {
        label: '物料类别',
        prop: 'categoryName'
      },
      {
        label: '物料',
        prop: 'name'
      }
    ]
  };
}

export const dialogSearchOption = {
  menuSpan: 6,
  submitBtn: false,
  emptyBtn: false,
  column: [
    {
      label: '物料类别',
      prop: 'title',
      span: 8
    }
  ]
};
